package com.flexpasta.penneframework.remote
{
	import mx.rpc.events.ResultEvent;
	import mx.rpc.http.mxml.HTTPService;

	public class PenneHTTPService extends HTTPService implements IPenneObjectResult
	{		
		private var resultFunction:Function;
		
		public function PenneHTTPService(rootURL:String=null, destination:String=null)
		{
			super(rootURL, destination);
			this.addEventListener(ResultEvent.RESULT, internalResponse);
		}
		
		private function internalResponse(resultEvent:ResultEvent):void
		{
			resultFunction(resultEvent.result);
		}
		
		public function setResultFunction(result:Function):void
		{
			resultFunction = result;
		}
		
	}
}